<?php 
class NavigationHelper extends AppHelper
{
	/**
	 * Type array
	 * enter all basic path/static path for the website so that it can be used creating paths.
	 * With key as name and its value as link 
	 */
	var $basicPath = array('Home'=>'/','Reviews'=>'/cafes/index/','Blog'=>'/blog/','Add A Cafe'=>'/cafes/add/','Suggest A Cafe'=>'/cafes/add/','Write A Post'=>'/posts/add/','My Profile'=>'/user/','Edit Profile'=>'/users/editProfile/','My Reviews'=>'/reviews/myReviews/cafe/','My Favorites'=>'/cafes/myFavorites/','My Comments'=>'/comments/myComments/Post/' ,'My Photos'=>'/myGallery/Cafe/','Register'=>'/users/register/','Login'=>'/users/login/','Become A Spotter'=>'/users/spotterRequest/','Forgot Password'=>'/users/forgotPassword','Register Success'=>'/users/registerSucess');
	
	var $helpers = array('Html');
	
	/**
	 * If set to true it will append present url to bread crumb by itself
	 */
	var $showPesentUrl = true;
	
	var $pesentUrlName = '';

	var $htmlOptions = array('escape'=>false);
	
	/**
	 * Funtion Creates bread crum based on args passed
	 * If a argument is an array it take it key as String and value as link for creating bread crumb
	 *
	 */
	function createBreadCrumb()
	{
		$links = func_get_args();
		$basicPathName =  array_keys($this->basicPath);
		//Get Instance of view
		$view = ClassRegistry::getObject('View');
		foreach ($links as $link)
		{
			if(is_string($link))
			{
				if(in_array($link,$basicPathName))
					$list[$link] = $this->basicPath[$link];
			}elseif(is_array($link))
				$list[key($link)] = current($link);
		}
		
		if($this->showPesentUrl==true)
			$list[$this->pesentUrlName] ='/'.$view->params['url']['url'];
		
		return $view->element('bread_crumb',array('out'=>$list,'plugin'=>'messages'));	
		
	}
	
	function setPesentUrlName($name)
	{
		$this->pesentUrlName = $name;
	}
}